package cn.minions.testSpring.controller;

import java.util.List;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.RepositoryService;
import org.activiti.engine.RuntimeService;
import org.activiti.engine.TaskService;
import org.activiti.engine.repository.ProcessDefinition;
import org.springframework.beans.factory.annotation.Autowired;

import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinalplus.plugin.spring.IocInterceptor;

import cn.minions.testMybatis.SystemAdmin;
import cn.minions.testSpring.Service.TestService;

@Before(IocInterceptor.class)
@org.springframework.stereotype.Controller
public class BlogController extends Controller {
	
	@Autowired
	private TestService service ;
	@Autowired
	private ProcessEngine processEngine;
	@Autowired
    private RepositoryService repositoryService;
    @Autowired
    private RuntimeService runtimeService;
    @Autowired
    private TaskService taskService;
    @Autowired
    private RuntimeService historyService;
    @Autowired
    private TaskService managementService;

//	@Autowired
//	@Inject
//	@Resource
//	public void setApplicationContext(ApplicationContext ctx) {
//		System.out.println("HelloController attr[ApplicationContext] 已出入。。");
//	}
	
	public void index() {
		try {
			System.out.println("=================");
			SystemAdmin systemAdmin = new SystemAdmin();
			service.update(systemAdmin);
			renderText("Hello JFinal World1.");
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			renderText("Hello JFinal World.");
		}
	}
	
	public void t() {
		List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().list();
    	for (ProcessDefinition processDefinition : list) {
    		System.out.println(processDefinition.getId() + "===========");
    	}
		renderText("Hello JFinal World." );
	}
	
}
